<?php
class Common
{
	public static function stringToMySQLDate($customDate)
	{
		$newdate = substr($customDate,6,4) . "-" . substr($customDate,3,2) . "-" .substr($customDate,0,2);
		$timestamp = strtotime($newdate);
		return date("Y-m-d H:i:s", $timestamp);
	}
	public static function mySQLDatetimeToString($customDate)
	{
		return substr($customDate,8,2) . "-" . substr($customDate,5,2) . "-" .substr($customDate,0,4);
	}
	public static function convertDateTimeToString($customDate)
	{
		//hh:mm dd-mm-yyyy
                //die(print $customDate);
		$dateConvert = substr($customDate,12,15);              
		$dateConvert .= "-" . substr($customDate,9,2);
		$dateConvert .= "-" . substr($customDate,6,2);
		$dateConvert .= " " . substr($customDate,0,5);

		$dateConvert .= ":00";
		return $dateConvert;
	}
	public static function convertStringToDateTime($customDate)
	{
		//yyyy-mm-dd hh:mm:ss
		//die(print ($customDate.lenght));
		$dateConvert = substr($customDate,11,5);
		$dateConvert .= " " . substr($customDate,8,2);
		$dateConvert .= "-" . substr($customDate,5,2);
		$dateConvert .= "-" . substr($customDate,0,4);	
		return $dateConvert;
	}
	public static function getAdminCode()
	{
		return '3';	
	}
	public static function getManagerCode()
	{
		return '2';
	}
	public static function getClerkCode()
	{
		return '1';
	}
	public static function getUnDeletedCode(){
		return '0';
	}
	public static function getDeletedCode(){
		return '1';
	}
}